/*
 * shapes.c
 *
 *  Created on: Feb 26, 2012
 *      Author: a0272955
 */


/*
 *
 *
 * 0  8  0  8  0  8  0  8
 * 1  9  1  9  1  9  1  9
 * 2  A  2  A  2  A  2  A
 * 3  B  3  B  3  B  3  B
 * 4  C  4  C  4  C  4  C
 * 5  D  5  D  5  D  5  D
 * 6  E  6  E  6  E  6  E
 * 7  F  7  F  7  F  7  F
 *

 *
 */


#include "../Functions/cube_functions.h"
#include "../Functions/rotation.h"
#include "../Functions/binary.h"
#include "shapes.h"
#include "stdlib.h"


extern void cube_show_loop(int cycles);

void
diamond(void){



        //  MAKE A DIAMOND

        cube[0][0] = CLEAR;
        cube[0][1] = CLEAR;
        cube[0][2] = CLEAR;
        cube[0][3] = CLEAR;
        cube[0][4] = CLEAR;
        cube[0][5] = CLEAR;
        cube[0][6] = CLEAR;
        cube[0][7] = CLEAR;
        /////////////////////////

        cube[1][0] = DIAMOND_0_0 ;
        cube[1][1] = DIAMOND_0_1 ;
        cube[1][2] = DIAMOND_0_2 ;
        cube[1][3] = DIAMOND_0_3 ;
        cube[1][4] = DIAMOND_0_4 ;
        cube[1][5] = DIAMOND_0_5 ;
        cube[1][6] = DIAMOND_0_6 ;
        cube[1][7] = DIAMOND_0_7 ;
        /////////////////////////

        cube[2][0] = DIAMOND_1_0 ;
        cube[2][1] = DIAMOND_1_1 ;
        cube[2][2] = DIAMOND_1_2 ;
        cube[2][3] = DIAMOND_1_3 ;
        cube[2][4] = DIAMOND_1_4 ;
        cube[2][5] = DIAMOND_1_5 ;
        cube[2][6] = DIAMOND_1_6 ;
        cube[2][7] = DIAMOND_1_7 ;

        /////////////////////////

        cube[3][0] = DIAMOND_2_0 ;
        cube[3][1] = DIAMOND_2_1 ;
        cube[3][2] = DIAMOND_2_2 ;
        cube[3][3] = DIAMOND_2_3 ;
        cube[3][4] = DIAMOND_2_4 ;
        cube[3][5] = DIAMOND_2_5 ;
        cube[3][6] = DIAMOND_2_6 ;
        cube[3][7] = DIAMOND_2_7 ;

        /////////////////////////

        cube[4][0] = DIAMOND_3_0 ;
        cube[4][1] = DIAMOND_3_1 ;
        cube[4][2] = DIAMOND_3_2 ;
        cube[4][3] = DIAMOND_3_3 ;
        cube[4][4] = DIAMOND_3_4 ;
        cube[4][5] = DIAMOND_3_5 ;
        cube[4][6] = DIAMOND_3_6 ;
        cube[4][7] = DIAMOND_3_7 ;

        /////////////////////////

        cube[5][0] = DIAMOND_2_0 ;
        cube[5][1] = DIAMOND_2_1 ;
        cube[5][2] = DIAMOND_2_2 ;
        cube[5][3] = DIAMOND_2_3 ;
        cube[5][4] = DIAMOND_2_4 ;
        cube[5][5] = DIAMOND_2_5 ;
        cube[5][6] = DIAMOND_2_6 ;
        cube[5][7] = DIAMOND_2_7 ;

        /////////////////////////

        cube[6][0] = DIAMOND_1_0 ;
        cube[6][1] = DIAMOND_1_1 ;
        cube[6][2] = DIAMOND_1_2 ;
        cube[6][3] = DIAMOND_1_3 ;
        cube[6][4] = DIAMOND_1_4 ;
        cube[6][5] = DIAMOND_1_5 ;
        cube[6][6] = DIAMOND_1_6 ;
        cube[6][7] = DIAMOND_1_7 ;

        /////////////////////////

        cube[7][0] = DIAMOND_0_0 ;
        cube[7][1] = DIAMOND_0_1 ;
        cube[7][2] = DIAMOND_0_2 ;
        cube[7][3] = DIAMOND_0_3 ;
        cube[7][4] = DIAMOND_0_4 ;
        cube[7][5] = DIAMOND_0_5 ;
        cube[7][6] = DIAMOND_0_6 ;
        cube[7][7] = DIAMOND_0_7 ;

        int i;
        for(i=0;i<8;i++){
        	rotate_90_deg();
			cube_show_loop(6);
        }

}

void
solid(void){



        //  SOLID CUBE
        int y,z;
        for(y=0; y<NUM_LAYERS; y++)
                {
                        for(z=0; z<NUM_ICS; z++)
                        {
                                cube[y][z]=0xffff;
                        }
                }
}


void
clear(void){

        //  CLEAR CUBE
        int y,z;
        for(y=0; y<NUM_LAYERS; y++)
		{
			for(z=0; z<8; z++)
			{
				cube[y][z]=0x0000;
			}
		}
}

// Clear single layer of the cube. //
void
cube_clear_layer(unsigned short layer)
{
        int j;

        for( j=0; j<NUM_LAYERS; j++)
        {
                cube[layer][j] = 0;
        }
}


